﻿using MovieFactory.Core;
using MovieFactory.Core.Primitives;


namespace MovieFactory.Sandbox {

    public class RayInfo : IRay {
        public Vector Org, Dir;
        public float MinT, MaxT;

        public RayInfo(Vector org, Vector dir, float t0, float t1) {
            this.Org = org;
            this.Dir = dir;
            this.MinT = t0;
            this.MaxT = t1;
        }

        public RayInfo(){}

        public RayInfo(RayInfo vray) {
            this.Org = vray.Org;
            this.Dir = vray.Dir;
            this.MinT = vray.MinT;
            this.MaxT = vray.MaxT;
        }

        #region IRay Members

        public Vector Origin {
            get { return Org; }
        }

        public Vector Direction {
            get { return Dir; }
        }

        public float Min {
            get { return MinT; }
        }

        public float Max {
            get { return MaxT; }
        }

        public Vector Point(float distance) {
            return Org + Dir*distance;
        }
        public void SetSegment(float min, float max) {
            this.MinT = min;
            this.MaxT = max;
        }
        
        #endregion
    }
}
